#include <stdio.h>

// 判断IP地址是否在指定网络中
int is_in_net(unsigned char *ip, unsigned char *netip, unsigned char *mask) {
    for (int i = 0; i < 4; i++) {
        if ((ip[i] & mask[i]) != netip[i]) {
            return 0;
        }
    }
    return 1;
}

int main() {

    unsigned char test_ip[] = {192, 168, 1, 100};
    unsigned char test_netip[] = {192, 168, 1, 0};
    unsigned char test_mask[] = {255, 255, 255, 0};

    if (is_in_net(test_ip, test_netip, test_mask)) {
        printf("IP地址在指定网络中\n");
    } else {
        printf("IP地址不在指定网络中\n");
    }

    return 0;
}